<?php
require('../config.php');

		$gid=$_REQUEST['gid'];
		$start=0;
		$num=10;
		if(isset($_REQUEST['start'])) $start=$_REQUEST['start'];
		if(isset($_REQUEST['num'])) $num=$_REQUEST['num'];
		$sql="select r.ip,r.gonumber,r.time,r.uid from `".$oto."_member_go_record` as r where shopid='{$gid}' order by `time` desc limit $start,$num";
		$result=$db->query($sql);
		while($row=$result->fetch_assoc()){
			$record[]=$row;//将取得的所有数据赋值给person_info数组
		}
		if(isset($record))
		{
			for($i=0;$i<count($record);$i++)
			{
				$xsd=explode('.',$record[$i]['time']);
				if(count($xsd)>1) $xsd=$xsd[1];
				else $xsd=$xsd[0];
				$record[$i]['time_data']=date('Y-m-d H:i:s',$record[$i]['time']).'.'.$xsd;
				$uid=$record[$i]['uid'];
				$sql="SELECT userName,userPhoto FROM ".$oto."_users where userId='{$uid}' ";
				$result=$db->query($sql);
				while($row=$result->fetch_assoc()){
					$users[$i]=$row;//将取得的所有数据赋值给person_info数组
				}
				if(isset($users[$i]))
				{
					$record[$i]['userName']=$users[$i]['userName'];
					$record[$i]['userPhoto']=$users[$i]['userPhoto'];
				}
				else
				{
					$record[$i]['userName']="";
					$record[$i]['userPhoto']="";
				}
			}
			echo json_encode($record);
		}
		else echo '[]';
?>